#include<stdio.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
#include<stdlib.h>

int main()
{
	pid_t pid;
	pid = fork();
	if(pid == 0)
	{
		sleep(10);
		exit(10);
	}
	else if(pid > 0)
	{
		int status = 0;
		printf("child pid:%d\n",pid);
		int ret = wait(&status);
		if(ret > 0 && (status & 0x7F) == 0)
		{
			printf("ret:%d,exit code: %d\n",ret,(status>>8)&0xFF);
		}
		else if(ret > 0)
			printf("sig code:%d\n",status&0x7F);
	}
	return 0;
}
